<h1>Listing sections</h1>

<table>
  <tr>
  <% for column in Section.content_columns %>
    <th><%= column.human_name %></th>
  <% end %>
  </tr>
  
<% for section in @sections %>
  <tr>
  <% for column in Section.content_columns %>
    <td><%=h section.send(column.name) %></td>
  <% end %>
  
    <td><%= link_to 'List articles', { :action => 'list_articles_by_section', :id => section}  %></td>
    <td><%= link_to 'Show', :action => 'show_section', :id => section %></td>
    <td><%= link_to 'Edit', :action => 'edit_section', :id => section %></td>

    <td><%= link_to 'Add article', :action => 'new_article_in_section', :section => section %></td>
    
    <td><%= link_to 'Destroy', { :action => 'destroy_section', :id => section }, :confirm => 'Are you sure?' %></td>
  </tr>
<% end %>
</table>

<%= link_to 'Previous page', { :page => @section_pages.current.previous } if @section_pages.current.previous %>
<%= link_to 'Next page', { :page => @section_pages.current.next } if @section_pages.current.next %> 

<br />

